from frontend.roleApplication import RoleApplication;
from frontend.form import Type;
from unique import UNIQUE;

class Contractor(RoleApplication):
    """ The Contractor Information Interface """

    def __init__(self):
        super(Contractor, self).__init__("construction"+UNIQUE, "Contractor");
        self.register_transition_step("ProjectDetails", self.project_details_form_creator, name_fields=["sequence", "FirstName", "LastName"]);
        self.register_transition_step("ManageSubs", self.manage_subs_form_creator, name_fields=["sequence", "FirstName", "LastName"]);
        self.register_transition_step("FinalizeProject", self.finalize_project_form_creator, name_fields=["sequence", "FirstName", "LastName"]);

    def project_details_form_creator(self, stepname, form):
        form.add_html_label('<B>Project Details:</B>')
        form.add_field(Type.SHORTSTRING, "ContractorName", labeltext="Name", initial="First/Last");
        form.add_field(Type.SHORTSTRING, "Budget", labeltext="Budget", initial="Budget");
        form.add_field(Type.SHORTSTRING, "StartDate", labeltext="Start Date", initial="Start Date");
        form.add_field(Type.SHORTSTRING, "EndDate", labeltext="End Date", initial="End Date");
        form.add_field(Type.SHORTSTRING, "StreetAddress", labeltext="Street Address", initial="Street Address");
        form.add_field(Type.LONGSTRING, "Notes", labeltext="Notes")

    def manage_subs_form_creator(self, stepname, form):
        form.add_html_label('<B>Foundation:</B>')
        form.add_field(Type.CHOICE, "Complete In-House or Sub-Out", labeltext="In-House/Sub-Out", choices=['In-House', 'Sub-Out'], initial='In-House');
        form.add_field(Type.CURRENCY, "Costs", labeltext="Costs")
        #form.add_field(Type.LONGSTRING, "Notes", labeltext="Notes")
        form.add_html_label('<B>Framing:</B>')
        form.add_field(Type.CHOICE, "Complete In-House or Sub-Out", labeltext="In-House/Sub-Out", choices=['In-House', 'Sub-Out'], initial='In-House');
        form.add_field(Type.CURRENCY, "Costs", labeltext="Costs")
        #form.add_field(Type.LONGSTRING, "Notes", labeltext="Notes")
        form.add_html_label('<B>Electrical:</B>')
        form.add_field(Type.CHOICE, "Complete In-House or Sub-Out", labeltext="In-House/Sub-Out", choices=['In-House', 'Sub-Out'], initial='In-House');
        form.add_field(Type.CURRENCY, "Costs", labeltext="Costs")
        #form.add_field(Type.LONGSTRING, "Notes", labeltext="Notes")
        form.add_html_label('<B>Plumbing:</B>')
        form.add_field(Type.CHOICE, "Complete In-House or Sub-Out", labeltext="In-House/Sub-Out", choices=['In-House', 'Sub-Out'], initial='In-House');
        form.add_field(Type.CURRENCY, "Costs", labeltext="Costs")
        
        form.add_field(Type.LONGSTRING, "Notes", labeltext="Notes")
    
    def finalize_project_form_creator(self, stepname, form):
        form.add_html_label('<B>Final Approval:</B>')
        form.add_field(Type.CHOICE, "Inspection Approved?", labeltext="Yes/No", choices=['Yes', 'No'], initial='Yes');

if __name__ == '__main__':
    app = Contractor();
    app.MainLoop();